package org.bees.cms.core.util.record;

import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;

import org.bees.cms.core.util.EntityListener;

public class Recorder implements EntityListener<Recordable> {

	@PrePersist
	@Override
	public void $insert(Recordable recordable) throws Exception {
		Record record = new Record();
		record.setOperator("添加人");
		record.setTime(System.currentTimeMillis());
		recordable.setCreate(record);
		recordable.setModify(record);
	}

	@Override
	public void _insert(Recordable recordable) throws Exception {
		// TODO Auto-generated method stub

	}

	@PreUpdate
	@Override
	public void $update(Recordable recordable) throws Exception {
		Record record = new Record();
		record.setOperator("修改人");
		record.setTime(System.currentTimeMillis());
		recordable.setModify(record);
	}

	@Override
	public void _update(Recordable recordable) throws Exception {
		// TODO Auto-generated method stub

	}

	@Override
	public void $remove(Recordable recordable) throws Exception {
		// TODO Auto-generated method stub

	}

	@Override
	public void _remove(Recordable recordable) throws Exception {
		// TODO Auto-generated method stub

	}

}
